import teamEndorserRepository from '@/repositories/teamEndorser'

// const getDisplayNameResult = async (teamId) => {
//   return await teamEndorserRepository.getDisplayName(teamId)
// }

const getTeamEndorserListByTeamId = async (teamId) => {
  let searchFilter = {
    fieldName: 'team',
    operator: 'EQ',
    value: teamId
  }
  let searchFilters = []
  searchFilters.push(searchFilter)
  let params = {}
  params.searchFilters = searchFilters
  let result = await teamEndorserRepository.getTeamEndorserList(params)
  let teamEndorserList = []
  teamEndorserList = result
  return teamEndorserList
}

const deleteTeamEndorserById = async (teamEndorserId) => {
  return await teamEndorserRepository.deleteTeamEndorser(teamEndorserId)
}

const addTeamEndorser = async (teamEndorser) => {
  teamEndorser.endorser = teamEndorser.endorser.toUpperCase()
  return await teamEndorserRepository.addTeamEndorser(teamEndorser)
}

export default {
  // getDisplayNameResult: getDisplayNameResult,
  getTeamEndorserListByTeamId: getTeamEndorserListByTeamId,
  deleteTeamEndorserById: deleteTeamEndorserById,
  addTeamEndorser: addTeamEndorser
}
